<div class="sc-cnt-repositorio">
        
    <div class="col itg-mn-disciplina">
        <h2>Meus Conteúdos<?php //echo $this->dis['DCP_NOM']; ?></h2>
        <ul>
        <?php foreach($this->menu as $row){ ?> 
            <li><a href="<?php echo $this->baseUrl($this->modulo.'/'.$this->controller.'/index/dcp_id/'.$row['DCP_ID']); ?>"><?php echo $row['DCP_NOM']; ?></a></li>
        <?php } ?>
        <ul> 
    </div> 

    <div class="content-tb">
            <div class="tl-pag">Tópicos <a class="btn_nv" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => '')); ?>">Criar Tópico</a></div>
        <table class="nrmprd">          
        <?php foreach($this->topicos as $key => $row){ 
            
            $query = 'SELECT SQL_CACHE * FROM CONTEUDO WHERE TPC_ID = '.$row['TPC_ID'].' AND CON_STA = 1 ORDER BY CON_ORD';
            $conteudos = $this->db->fetchAll($query);
            
        ?>
            <tr>
                <td class="w100">
                    <?php if(count($conteudos) > 0) { ?>
                    <span class="icn_exp_cont rot90" itemid="<?php echo $row['TPC_ID']?>"></span>
                    <?php } ?>
                    &nbsp;<?php echo $row['TPC_NOM'];?></td>
                <td style="width: 65px"><?php echo Datetools::amd_dma($row['TPC_DAT']);?></td>
                <td>
                    <div class="cnt_btn_ord">
                        <a class="btn_ord" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'order', 'id' => $row['TPC_ID'], 'ord'=> $row['TPC_ORD'], 'pos' => 0)); ?>"><span class="icn_stup"></span></a>
                        <a class="btn_ord" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'order', 'id' => $row['TPC_ID'], 'ord'=> $row['TPC_ORD'], 'pos' => 1)); ?>"><span class="icn_stdw"></span></a>
                    </div>
                </td>
                <td class="bc"><a class="btn" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'conteudo', 'tpc_id' => $row['TPC_ID'])); ?>">conteúdos</a></td>
                <td class="bc"><a class="btn" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => $row['TPC_ID'])); ?>">editar</a></td>
                <td class="bc"><a class="btn" href="javascript:void(0);" onclick="list_delete_msg('<?php echo $this->controller; ?>',<?php echo $row['TPC_ID'] ?>,$(this),'<?php echo $row['TPC_NOM'] ?>');">excluir</a></td>
            </tr>
            <?php
                // conteúdp
                foreach($conteudos as $key => $crow){ 
                    $arq = imagem::formatNomeArquivo($crow['CON_ID'],$crow['CON_DATHOR']);
                    $arq = glob('public/upload/conteudo/'.$arq.'.*');
                    $ext = '';
                    if(isset($arq[0])) {
                        $arq = $arq[0];
                        $ext = imagem::extensao($arq);
                    }
                    $icn = dominio::getClassIcon($ext);            
                    
                    
                    if($crow['TIP_ID'] == 1){
                        $link = $this->url(array('controller' => 'materiais', 'action' => 'play', 'id' => $crow['CON_ID']));
                        $target = '';
                    } else { 
                        $link = $this->urlbase.'/'.$arq;
                        $target = 'target="_black"';
                    } 
                    
                    
            ?>
            <tr class="cntsubitem-<?php echo $row['TPC_ID']?>" style="display: none;">
                <td class="w100 subitem" colspan="3"><?php echo $crow['CON_NOM'];?></td>
                <td style="width: 65px"><?php echo Datetools::amd_dma(substr($crow['CON_DATHOR'],0,10));?></td>
                <td style="text-align: center;">
                    <div class="cnt_btn_ord">
                        <a class="btn_ord" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'orderconteudo', 'id' => $crow['CON_ID'], 'ord'=> $crow['CON_ORD'], 'pos' => 0, 'tpc_id' => $crow['TPC_ID'], 'rtn' => 'index' )); ?>"><span class="icn_stup"></span></a>
                        <a class="btn_ord" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'orderconteudo', 'id' => $crow['CON_ID'], 'ord'=> $crow['CON_ORD'], 'pos' => 1, 'tpc_id' => $crow['TPC_ID'], 'rtn' => 'index' )); ?>"><span class="icn_stdw"></sapn></a>
                    </div>
                </td>
                <td class="bc"><a class="btn" href="<?php echo $link;?>" <?php echo $target;?> ><span class="<?php echo $icn; ?>"></span></a></td>
            </tr>
            <?php } ?>
            
            
            
        <?php } ?>
        </table>
    </div>
    
</div>

<?php //echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
 
